﻿@model AesApplication.Models.Job

@using AesApplication.Models;

@{
    ViewBag.Title = "Job Grid";
}

<h2>@Model.Title</h2>

<font color="red">
    @Html.Raw(TempData["Error"])
</font>

@if (Model.Applications.Where(x => x.Status == ApplicationStatus.AwaitingHire).Count() > 0)
{
    <form action="/HiringManager/UpdateGrid" method="post">
        <table>
            <tr>
                <td></td>
                <td>First</td>
                <td>Last</td>
                <td>City</td>
                <td>State</td>
                <td>Work History</td>
                <td>Education</td>
                @*        @foreach(Question quest in questions)
                    {
                        <td>@quest.Text</td>
                    }*@
            </tr>

            @foreach (Application app in Model.Applications)
            {
                if(app.Status == ApplicationStatus.AwaitingHire)
                { 
                <tr>
                    <td><input type="checkbox" name="AppCheckboxes" value="@app.ID" /></td>
                    <td>@app.FirstName</td>
                    <td>@app.LastName</td>
                    <td>@app.City</td>
                    <td>@app.State</td>
                    <td>@app.WorkHistory</td>
                    <td>@app.Education</td>
                    <td>@Html.ActionLink("Expand", "Application", new { id = @app.ID })</td>
                </tr>
                }
            }

        </table>
        <input type="submit" name="submit" id="hire" value="Hire" />
        <input type="submit" name="submit" id="discard" value="Discard" />
        <input type="submit" name="submit" id="cancel" value="Cancel" />
    </form>
}
else
{
    <p>There are no applications submitted for this job opening.</p>
    <form action="/HiringManager/UpdateGrid" method="post">
        <input type="submit" name="submit" id="back" value="back" />
    </form>
        }
